<#compress>
<!DOCTYPE html>
<html>
<head>
    <#include "plat/include.ftl"/>
    <script type="text/javascript" src="${base}/js/plugins/buttons/spin.min.js"></script>
    <script type="text/javascript" src="${base}/js/plugins/buttons/ladda.min.js"></script>
</head>
<body style="background: white">
<div class="ibox-content" style="padding: 10px">
    <form class="form-horizontal" id="commentForm">
        <input  type="hidden" id="code" value="${command.code}" name="code" />
        <div class="form-group">
            <label class="col-xs-3 control-label">渠道名称*：</label>
            <div class="col-xs-9">
                <input class="form-control" readonly="readonly" type="text" id="name" value="${command.name}" name="name" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-3 control-label">支付方式*：</label>
            <div class="col-xs-9">
                <@directive_pays flag='1'>
                    <div class="row">
                        <#list pays as p>
                            <div class="col-xs-4"><label class="i-checks"><input type="checkbox" name="payway" value="${p.code}" id="check${p.code}">${p.name}</label></div>
                        </#list>
                    </div>

                </@directive_pays>
            </div>
        </div>
        <div class="form-group">
            <div style="width: 100%;text-align: center">
                <button style="width: 120px" class="btn btn-primary btn-ladda btn-ladda-spinner" data-style="expand-right" data-spinner-color="#333" data-spinner-size="20" type="button" onclick="save()">提交</button>
            </div>
        </div>
    </form>
</div>
<script>
        <#list command.payway?split(',') as p>
        $('#check${p}').prop('checked',true);
        </#list>
    function save() {
        var rolename;
        var rolecode=$('#code').val();
        if($('input[type=checkbox]:checked').size()==0){
            tips('请选择支付方式',$('#paywaytr'));
            return;
        }
        var pays=[];
        $('input[type=checkbox]:checked').each(function () {
            pays.push($(this).val());
        });
        var data={code:rolecode,paywaycodes:pays.join(',')};
        var data={code:rolecode,name:rolename,flag:flag};
        var l = Ladda.create( document.querySelector( '.btn-ladda-spinner' ) );
        l.start();
        post('pl/platform/setPlats',data,function (result) {
            if(result.code==0){
                parent.table.ajax.reload();
                dialogClose();
            }else{
                alertError(result.message);
            }
            l.stop();
        });

    }
</script>
</body>
</html>
</#compress>